#! /usr/bin/env python

import waflib

from waflib.TaskGen import extension, feature, after, before

waflib.Task.task_factory('glslang', '${GLSLANG} -w --auto-map-bindings --auto-map-locations -g -V -o ${TGT} ${SRC}',
                      color='PINK',
                      after='proto_gen_py',
                      before='c cxx',
                      shell=False)

@extension('.vert', '.frag', '.comp')
def fragmentprogram_file(self, node):
    shader = self.create_task('glslang')
    shader.set_inputs(node)
    obj_ext = '.spv'
    out = node.change_ext(obj_ext)
    shader.set_outputs(out)

def build(bld):
    bld.program(features = 'cxx test',
                includes = '. ..',
                use = ['DLIB', 'PROFILE', 'SPIRV_CROSS', 'shaderc'],
                target = 'test_shaderc',
                source = ['test_shaderc.cpp'] + bld.path.ant_glob(['data/*.vert', 'data/*.frag', 'data/*.comp']))
